package org.apache.jsp.WEB_002dINF.view.pay;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import com.paypal.sdk.services.CallerServices;
import com.paypal.soap.api.*;
import com.macower.businessdata.entity.Order;

public final class confirmPayDetail_jsp extends org.apache.jasper.runtime.HttpJspBase
    implements org.apache.jasper.runtime.JspSourceDependent {

  private static final JspFactory _jspxFactory = JspFactory.getDefaultFactory();

  private static java.util.List _jspx_dependants;

  private javax.el.ExpressionFactory _el_expressionfactory;
  private org.apache.AnnotationProcessor _jsp_annotationprocessor;

  public Object getDependants() {
    return _jspx_dependants;
  }

  public void _jspInit() {
    _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
    _jsp_annotationprocessor = (org.apache.AnnotationProcessor) getServletConfig().getServletContext().getAttribute(org.apache.AnnotationProcessor.class.getName());
  }

  public void _jspDestroy() {
  }

  public void _jspService(HttpServletRequest request, HttpServletResponse response)
        throws java.io.IOException, ServletException {

    PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;


    try {
      response.setContentType("text/html; charset=UTF-8");
      pageContext = _jspxFactory.getPageContext(this, request, response,
      			null, true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write("\n");
      out.write("\n");
      out.write("    \n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");

	String path = request.getContextPath();    
	//获得项目完全路径（假设你的项目叫MyApp，那么获得到的地址就是 http://localhost:8080/MyApp/）:    
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path; 
	GetExpressCheckoutDetailsResponseDetailsType details = (GetExpressCheckoutDetailsResponseDetailsType)request.getAttribute("details") ;
	Order order = (Order)request.getAttribute("order") ;

      out.write("\n");
      out.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n");
      out.write("<html>\n");
      out.write(" <head>\n");
      out.write("\t\n");
      out.write(" </head>\n");
      out.write(" <body>\n");
      out.write("\n");
      out.write("    <div class=\"container-fluid\">\n");
      out.write("      <div class=\"row-fluid\">\n");
      out.write("\n");
      out.write("    \t\t<div class=\"offset2 span8\">\n");
      out.write("\n");
      out.write("          <table class=\"table table-bordered table-striped\">\n");
      out.write("             <thead>\n");
      out.write("              <tr>\n");
      out.write("                <th>Address</th>\n");
      out.write("                <th>Description</th>\n");
      out.write("              </tr>\n");
      out.write("            </thead>\n");
      out.write("            <tbody>\n");
      out.write("              <tr>\n");
      out.write("                <td>\n");
      out.write("                  Street 1:\n");
      out.write("                </td>\n");
      out.write("                <td>");
      out.print( order.getStreet1() );
      out.write("</td>\n");
      out.write("              </tr>\n");
      out.write("              <tr>\n");
      out.write("                <td>\n");
      out.write("                  Street 2:\n");
      out.write("                </td>\n");
      out.write("                <td>");
      out.print( order.getStreet2() );
      out.write("</td>\n");
      out.write("              </tr>\n");
      out.write("\t\t\t   <tr>\n");
      out.write("                <td>\n");
      out.write("                  City:\n");
      out.write("                </td>\n");
      out.write("                <td>");
      out.print( order.getCity() );
      out.write("</td>\n");
      out.write("              </tr>\n");
      out.write("\t\t\t   <tr>\n");
      out.write("                <td>\n");
      out.write("                  State:\n");
      out.write("                </td>\n");
      out.write("                <td>");
      out.print( order.getState() );
      out.write("</td>\n");
      out.write("              </tr> \n");
      out.write("\t\t\t  <tr>\n");
      out.write("                <td>\n");
      out.write("                  ZIP Code:\n");
      out.write("                </td>\n");
      out.write("                <td>");
      out.print( order.getZipCode() );
      out.write("</td>\n");
      out.write("              </tr> \n");
      out.write("\t\t\t  <tr>\n");
      out.write("                <td>\n");
      out.write("                  Country:\n");
      out.write("                </td>\n");
      out.write("                <td>");
      out.print( order.getCountryName() );
      out.write("</td>\n");
      out.write("              </tr>\n");
      out.write("\t\t\t  <tr>\n");
      out.write("                <td>\n");
      out.write("                  ShippingCalculationMode:\n");
      out.write("                </td>\n");
      out.write("                <td>");
      out.print( details.getUserSelectedOptions().getShippingCalculationMode() );
      out.write("</td>\n");
      out.write("              </tr>\n");
      out.write("\t\t\t   <tr>\n");
      out.write("                <td>\n");
      out.write("                  ShippingOptionAmount:\n");
      out.write("                </td>\n");
      out.write("                <td>");
      out.print( details.getUserSelectedOptions().getShippingOptionAmount() );
      out.write("</td>\n");
      out.write("              </tr> \n");
      out.write("\t\t\t  <tr>\n");
      out.write("                <td>\n");
      out.write("                 ShippingOptionName:\n");
      out.write("                </td>\n");
      out.write("                <td>");
      out.print( details.getUserSelectedOptions().getShippingOptionName() );
      out.write("</td>\n");
      out.write("              </tr>\n");
      out.write("\t\t\t   <tr>\n");
      out.write("                <td>\n");
      out.write("                 <strong>Order Total:</strong>\n");
      out.write("                </td>\n");
      out.write("                <td><font color=\"red\">");
      out.print( request.getParameter("currencyCodeType"));
      out.write("&nbsp;");
      out.print( (details.getPaymentDetails())[0].getOrderTotal() );
      out.write("</font></td>\n");
      out.write("              </tr>\n");
      out.write("            </tbody>\n");
      out.write("          </table>\n");
      out.write("           <div class=\"control-group\" align=\"center\">\n");
      out.write("\t           <form id=\"confirmFrom\" method=POST action=\"");
      out.print(basePath );
      out.write("/pay/confirmPayment\">\n");
      out.write("\t\t\t\t\t<input type=\"hidden\" name=\"token\" value=\"");
      out.print( details.getToken() );
      out.write("\" />\n");
      out.write("\t\t\t\t\t<input type=\"hidden\" name=\"PayerID\" value=\"");
      out.print( details.getPayerInfo().getPayerID());
      out.write("\" />\n");
      out.write("\t\t\t\t\t<input type=\"hidden\" name=\"currencyCodeType\" value=\"");
      out.print( request.getParameter("currencyCodeType"));
      out.write("\" />\n");
      out.write("\t\t\t\t\t<input type=\"hidden\" name=\"paymentAmount\" value=\"");
      out.print( (details.getPaymentDetails())[0].getOrderTotal() );
      out.write("\" />\n");
      out.write("\t\t\t\t\t<img alt=\"\" id=\"submitButtonId\" src=\"");
      out.print(basePath);
      out.write("/assets/icos/product/btnXpressCheckout.gif\" onclick=\"javascript:submitPay();\">\n");
      out.write("\t\t\t\t</form>\n");
      out.write("\t\t              \t\n");
      out.write("\t\t   </div>\n");
      out.write("\n");
      out.write("\n");
      out.write("          <hr>\n");
      out.write("    \t\t</div><!--/span8-->\n");
      out.write("\n");
      out.write("      </div><!-- row-fluid -->\n");
      out.write("\n");
      out.write("\n");
      out.write("    </div><!-- container-fluid -->\n");
      out.write("   <script type=\"text/javascript\">  \n");
      out.write("   function submitPay(){\n");
      out.write("\t   $(\"#submitButtonId\").attr(\"disabled\",\"disabled\") ;\n");
      out.write("\t\t$(\"#confirmFrom\").submit();\n");
      out.write("   }\n");
      out.write("   </script>\n");
      out.write("  \n");
      out.write("  </body>\n");
      out.write("</html>");
    } catch (Throwable t) {
      if (!(t instanceof SkipPageException)){
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0)
          try { out.clearBuffer(); } catch (java.io.IOException e) {}
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
      }
    } finally {
      _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
}
